USE [WebAccountant]
GO
/****** Object:  Table [dbo].[Employee]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Employee](
	[EmployeeID] [int] IDENTITY(1,1) NOT NULL,
	[FirstName] [nvarchar](50) NOT NULL,
	[LastName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Company]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Company](
	[CompanyID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](100) NULL,
	[Address] [nvarchar](100) NULL,
	[City] [nvarchar](50) NULL,
	[IdentificationNumber] [varchar](13) NULL,
	[TaxIdentificationNumber] [varchar](13) NULL,
	[Phone] [varchar](20) NULL,
 CONSTRAINT [PK_Company] PRIMARY KEY CLUSTERED 
(
	[CompanyID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[FixedSalaryEmployee]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FixedSalaryEmployee](
	[EmployeeID] [int] NOT NULL,
	[Salary] [numeric](10, 2) NOT NULL,
 CONSTRAINT [PK_FixedSalaryEmployee] PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SalaryCalculation]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SalaryCalculation](
	[SalaryCalculationID] [int] IDENTITY(1,1) NOT NULL,
	[GrossSalary] [numeric](10, 2) NOT NULL,
	[EmployeeID] [int] NOT NULL,
 CONSTRAINT [PK_SalaryCalculation] PRIMARY KEY CLUSTERED 
(
	[SalaryCalculationID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Partner]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Partner](
	[PartnerID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](100) NULL,
	[Address] [nvarchar](100) NULL,
	[City] [nvarchar](50) NULL,
	[CompanyID] [int] NOT NULL,
	[FirstName] [nvarchar](50) NULL,
	[IdentificationNumber] [varchar](13) NULL,
	[IsPayingTax] [bit] NULL,
	[LastName] [nvarchar](50) NULL,
	[PartnerType] [smallint] NULL,
	[Phone] [varchar](20) NULL,
	[TaxIdentificationNumber] [varchar](13) NULL,
 CONSTRAINT [PK_Partner] PRIMARY KEY CLUSTERED 
(
	[PartnerID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Invoice]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Invoice](
	[CompanyID] [int] NOT NULL,
	[InvoiceID] [int] IDENTITY(1,1) NOT NULL,
	[InvoiceNumber] [varchar](50) NULL,
	[PartnerID] [int] NULL,
	[ReleaseDate] [datetime] NULL,
	[ReleaseYear] [int] NULL,
	[SubTotal] [numeric](10, 2) NULL,
	[Vat] [numeric](10, 2) NULL,
	[Total] [numeric](10, 2) NULL,
 CONSTRAINT [PK_Invoice] PRIMARY KEY CLUSTERED 
(
	[InvoiceID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[OutputInvoice]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OutputInvoice](
	[InvoiceID] [int] NOT NULL,
	[ExportInvoiceAmount] [float] NULL,
	[InternalInvoiceAmount] [float] NULL,
	[OtherDeliveryInvoicesVatReleased] [float] NULL,
 CONSTRAINT [PK_OutputInvoice] PRIMARY KEY CLUSTERED 
(
	[InvoiceID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EntryInvoice]    Script Date: 04/17/2009 21:34:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EntryInvoice](
	[InvoiceID] [int] NOT NULL,
	[AmountWithoutVat] [float] NULL,
	[LumpSum] [float] NULL,
	[VatThatCanBeDeducted] [float] NULL,
	[VatThatCanNotBeDeducted] [float] NULL,
 CONSTRAINT [PK_EntryInvoice] PRIMARY KEY CLUSTERED 
(
	[InvoiceID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_EntryInvoice_Invoice]    Script Date: 04/17/2009 21:34:18 ******/
ALTER TABLE [dbo].[EntryInvoice]  WITH CHECK ADD  CONSTRAINT [FK_EntryInvoice_Invoice] FOREIGN KEY([InvoiceID])
REFERENCES [dbo].[Invoice] ([InvoiceID])
GO
ALTER TABLE [dbo].[EntryInvoice] CHECK CONSTRAINT [FK_EntryInvoice_Invoice]
GO
/****** Object:  ForeignKey [FK_Company1]    Script Date: 04/17/2009 21:34:18 ******/
ALTER TABLE [dbo].[Invoice]  WITH CHECK ADD  CONSTRAINT [FK_Company1] FOREIGN KEY([CompanyID])
REFERENCES [dbo].[Company] ([CompanyID])
GO
ALTER TABLE [dbo].[Invoice] CHECK CONSTRAINT [FK_Company1]
GO
/****** Object:  ForeignKey [FK_partner]    Script Date: 04/17/2009 21:34:18 ******/
ALTER TABLE [dbo].[Invoice]  WITH CHECK ADD  CONSTRAINT [FK_partner] FOREIGN KEY([PartnerID])
REFERENCES [dbo].[Partner] ([PartnerID])
GO
ALTER TABLE [dbo].[Invoice] CHECK CONSTRAINT [FK_partner]
GO
/****** Object:  ForeignKey [FK_OutputInvoice_Invoice]    Script Date: 04/17/2009 21:34:18 ******/
ALTER TABLE [dbo].[OutputInvoice]  WITH CHECK ADD  CONSTRAINT [FK_OutputInvoice_Invoice] FOREIGN KEY([InvoiceID])
REFERENCES [dbo].[Invoice] ([InvoiceID])
GO
ALTER TABLE [dbo].[OutputInvoice] CHECK CONSTRAINT [FK_OutputInvoice_Invoice]
GO
/****** Object:  ForeignKey [FK_Company]    Script Date: 04/17/2009 21:34:18 ******/
ALTER TABLE [dbo].[Partner]  WITH CHECK ADD  CONSTRAINT [FK_Company] FOREIGN KEY([CompanyID])
REFERENCES [dbo].[Company] ([CompanyID])
GO
ALTER TABLE [dbo].[Partner] CHECK CONSTRAINT [FK_Company]
GO
